#ifndef V2_NIM_TEAM_SERVICE_H
#define V2_NIM_TEAM_SERVICE_H
#include "v2_nim_internal.hpp"

namespace v2 {
/// @brief 群组服务
/// @pre
/// 调用 `V2NIMClient::get()` 拿到 client 实例
/// 调用 `client.getTeamService()` 拿到 teamService 实例
/// @par 示例代码
/// @code
/// auto& client = V2NIMClient::get();
/// auto& teamService = client.getStorageService();
/// @endcode
class V2NIMTeamService {
public:
    /// @brief 创建群组
    /// @param createTeamParams 创建群组参数
    /// @param inviteeAccountIds 群组创建时, 同时被邀请加入群的成员列表
    /// @param postscript 群组创建时, 邀请入群的附言
    /// @param antispamConfig 反垃圾配置
    /// @param success 成功回调
    /// @param failure 失败回调
    /// @return void
    /// @par 示例代码
    /// @code
    /// V2NIMCreateTeamParams createTeamParams;
    /// createTeamParams.name = "teamName";
    /// nstd::vector<nstd::string> inviteeAccountIds;
    /// inviteeAccountIds.push_back("account1");
    /// V2NIMAntispamConfig antispamConfig;
    /// teamService.createTeam(
    ///     createTeamParams,
    ///     inviteeAccountIds,
    ///     "postscript",
    ///     antispamConfig,
    ///     [](V2NIMCreateTeamResult result) {
    ///         // do something
    ///     },
    ///     [](V2NIMError error) {
    ///         // get message list failed, handle error
    ///     });
    /// @endcode
    virtual void createTeam(V2NIMCreateTeamParams createTeamParams,
        nstd::vector<nstd::string> inviteeAccountIds,
        nstd::string postscript,
        V2NIMAntispamConfig antispamConfig,
        V2NIMSuccessCallback<V2NIMCreateTeamResult> success,
        V2NIMFailureCallback failure) = 0;

    /// @brief 修改群组信息
    /// @param teamId 群组 id
    /// @param teamType 群组类型
    /// @param updateTeamInfoParams 修改群组信息参数
    /// @param antispamConfig 反垃圾配置
    /// @param success 成功回调
    /// @param failure 失败回调
    /// @return void
    /// @par 示例代码
    /// @code
    /// V2NIMUpdateTeamInfoParams updateTeamInfoParams;
    /// updateTeamInfoParams.name = "new team name";
    /// V2NIMAntispamConfig antispamConfig;
    /// teamService.updateTeamInfo(
    ///     "teamId",
    ///     V2NIM_TEAM_TYPE_NORMAL,
    ///     updateTeamInfoParams,
    ///     antispamConfig,
    ///     []() {
    ///         // update team info success
    ///     },
    ///     [](V2NIMError error) {
    ///         // update team info failed, handle error
    ///     });
    /// @endcode
    virtual void updateTeamInfo(nstd::string teamId,
        V2NIMTeamType teamType,
        V2NIMUpdateTeamInfoParams updateTeamInfoParams,
        V2NIMAntispamConfig antispamConfig,
        V2NIMSuccessCallback<void> success,
        V2NIMFailureCallback failure) = 0;

    /// @brief 退出群组
    /// @param teamId 群组 id
    /// @param teamType 群组类型
    /// @param success 成功回调
    /// @param failure 失败回调
    /// @return void
    /// @par 示例代码
    /// @code
    /// teamService.leaveTeam(
    ///     "teamId",
    ///     V2NIM_TEAM_TYPE_NORMAL,
    ///     []() {
    ///         // leave team success
    ///     },
    ///     [](V2NIMError error) {
    ///         // leave team failed, handle error
    ///     });
    /// @endcode
    virtual void leaveTeam(nstd::string teamId, V2NIMTeamType teamType, V2NIMSuccessCallback<void> success, V2NIMFailureCallback failure) = 0;

    /// @brief 获取群组信息
    /// @param teamId 群组 id
    /// @param teamType 群组类型
    /// @param success 成功回调
    /// @param failure 失败回调
    /// @return void
    /// @par 示例代码
    /// @code
    /// teamService.getTeamInfo(
    ///     "teamId",
    ///     V2NIM_TEAM_TYPE_NORMAL,
    ///     [](V2NIMTeam team) {
    ///         // get team info success
    ///     },
    ///     [](V2NIMError error) {
    ///         // get team info failed, handle error
    ///     });
    /// @endcode
    virtual void getTeamInfo(nstd::string teamId, V2NIMTeamType teamType, V2NIMSuccessCallback<V2NIMTeam> success, V2NIMFailureCallback failure) = 0;

    /// @brief 根据群组 ID 获取群组信息
    /// @param teamIds 群组 id 列表
    /// @param teamType 群组类型
    /// @param success 成功回调
    /// @param failure 失败回调
    /// @return void
    /// @par 示例代码
    /// @code
    /// nstd::vector<nstd::string> teamIds;
    /// teamIds.push_back("teamId1");
    /// teamIds.push_back("teamId2");
    /// teamService.getTeamInfoByIds(
    ///     teamIds,
    ///     V2NIM_TEAM_TYPE_NORMAL,
    ///     [](nstd::vector<V2NIMTeam> teamList) {
    ///         // get team info success
    ///     },
    ///     [](V2NIMError error) {
    ///         // get team info failed, handle error
    ///     });
    /// @endcode
    virtual void getTeamInfoByIds(nstd::vector<nstd::string> teamIds,
        V2NIMTeamType teamType,
        V2NIMSuccessCallback<nstd::vector<V2NIMTeam>> success,
        V2NIMFailureCallback failure) = 0;

    /// @brief 解散群组
    /// @param teamId 群组 id
    /// @param teamType 群组类型
    /// @param success 成功回调
    /// @param failure 失败回调
    /// @return void
    /// @par 示例代码
    /// @code
    /// teamService.dismissTeam(
    ///     "teamId",
    ///     V2NIM_TEAM_TYPE_NORMAL,
    ///     []() {
    ///         // dismiss team success
    ///     },
    ///     [](V2NIMError error) {
    ///         // dismiss team failed, handle error
    ///     });
    /// @endcode
    virtual void dismissTeam(nstd::string teamId, V2NIMTeamType teamType, V2NIMSuccessCallback<void> success, V2NIMFailureCallback failure) = 0;

    /// @brief 邀请成员加入群组
    /// @param teamId 群组 id
    /// @param teamType 群组类型
    /// @param inviteeAccountIds 被邀请人 id 列表
    /// @param postscript 邀请附言
    /// @param success 成功回调, 返回邀请失败的账号列表
    /// @param failure 失败回调
    /// @return void
    /// @par 示例代码
    /// @code
    /// nstd::vector<nstd::string> inviteeAccountIds;
    /// inviteeAccountIds.push_back("account1");
    /// teamService.inviteMember(
    ///     "teamId",
    ///     V2NIM_TEAM_TYPE_NORMAL,
    ///     inviteeAccountIds,
    ///     "postscript",
    ///     [](nstd::vector<nstd::string> failedList) {
    ///         // invite member success
    ///     },
    ///     [](V2NIMError error) {
    ///         // invite member failed, handle error
    ///     });
    /// @endcode
    virtual void inviteMember(nstd::string teamId,
        V2NIMTeamType teamType,
        nstd::vector<nstd::string> inviteeAccountIds,
        nstd::string postscript,
        V2NIMSuccessCallback<nstd::vector<nstd::string>> success,
        V2NIMFailureCallback failure) = 0;

    /// @brief 同意邀请入群
    /// @param teamId 群组 id
    /// @param teamType 群组类型
    /// @param invitorAccountId 邀请人 id
    /// @param success 成功回调
    /// @param failure 失败回调
    /// @return void
    /// @par 示例代码
    /// @code
    /// V2NIMTeamJoinActionInfo invitationInfo;
    /// // get invitationInfo from notification or query
    /// // ...
    /// teamService.acceptInvitation(
    ///     invitationInfo,
    ///     [](V2NIMTeam team) {
    ///         // accept invitation success
    ///     },
    ///     [](V2NIMError error) {
    ///         // accept invitation failed, handle error
    ///     });
    /// @endcode
    virtual void acceptInvitation(V2NIMTeamJoinActionInfo invitationInfo, V2NIMSuccessCallback<V2NIMTeam> success, V2NIMFailureCallback failure) = 0;

    /// @brief 拒绝邀请入群
    /// @param teamId 群组 id
    /// @param teamType 群组类型
    /// @param invitorAccountId 邀请人 id
    /// @param postscript 拒绝邀请的理由附言
    /// @param success 成功回调
    /// @param failure 失败回调
    /// @return void
    /// @par 示例代码
    /// @code
    /// V2NIMTeamJoinActionInfo invitationInfo;
    /// // get invitationInfo from notification or query
    /// // ...
    /// teamService.rejectInvitation(
    ///     invitationInfo,
    ///     "postscript",
    ///     []() {
    ///         // reject invitation success
    ///     },
    ///     [](V2NIMError error) {
    ///         // reject invitation failed, handle error
    ///     });
    /// @endcode
    virtual void rejectInvitation(V2NIMTeamJoinActionInfo invitationInfo,
        nstd::string postscript,
        V2NIMSuccessCallback<void> success,
        V2NIMFailureCallback failure) = 0;

    /// @brief 踢出群组成员
    /// @param teamId 群组 id
    /// @param teamType 群组类型
    /// @param memberAccountIds 踢出群组的成员账号列表
    /// @param success 成功回调
    /// @param failure 失败回调
    /// @return void
    /// @par 示例代码
    /// @code
    /// nstd::vector<nstd::string> memberAccountIds;
    /// memberAccountIds.push_back("account1");
    /// teamService.kickMember(
    ///     "teamId",
    ///     V2NIM_TEAM_TYPE_NORMAL,
    ///     memberAccountIds,
    ///     []() {
    ///         // kick member success
    ///     },
    ///     [](V2NIMError error) {
    ///         // kick member failed, handle error
    ///     });
    /// @endcode
    virtual void kickMember(nstd::string teamId,
        V2NIMTeamType teamType,
        nstd::vector<nstd::string> memberAccountIds,
        V2NIMSuccessCallback<void> success,
        V2NIMFailureCallback failure) = 0;

    /// @brief 申请加入群组
    /// @param teamId 群组 id
    /// @param teamType 群组类型
    /// @param postscript 申请入群的附言
    /// @param success 成功回调
    /// @param failure 失败回调
    /// @return void
    /// @par 示例代码
    /// @code
    /// teamService.applyJoinTeam(
    ///     "teamId",
    ///     V2NIM_TEAM_TYPE_NORMAL,
    ///     "postscript",
    ///     [](V2NIMTeam team) {
    ///         // apply join team success
    ///     },
    ///     [](V2NIMError error) {
    ///         // apply join team failed, handle error
    ///     });
    /// @endcode
    virtual void applyJoinTeam(nstd::string teamId,
        V2NIMTeamType teamType,
        nstd::string postscript,
        V2NIMSuccessCallback<V2NIMTeam> success,
        V2NIMFailureCallback failure) = 0;

    /// @brief 接受入群申请
    /// @param teamId 群组 id
    /// @param teamType 群组类型
    /// @param applyAccountId 申请人 id
    /// @param success 成功回调
    /// @param failure 失败回调
    /// @return void
    /// @par 示例代码
    /// @code
    /// V2NIMTeamJoinActionInfo applicationInfo;
    /// // get applicationInfo from notification or query
    /// // ...
    /// teamService.acceptJoinApplication(
    ///     applicationInfo,
    ///     []() {
    ///         // accept join application success
    ///     },
    ///     [](V2NIMError error) {
    ///         // accept join application failed, handle error
    ///     });
    /// @endcode
    virtual void acceptJoinApplication(V2NIMTeamJoinActionInfo applicationInfo, V2NIMSuccessCallback<void> success, V2NIMFailureCallback failure) = 0;

    /// @brief 拒绝入群申请
    /// @param teamId 群组 id
    /// @param teamType 群组类型
    /// @param applyAccountId 申请人 id
    /// @param postscript 拒绝入群申请的附言
    /// @param success 成功回调
    /// @param failure 失败回调
    /// @return void
    /// @par 示例代码
    /// @code
    /// V2NIMTeamJoinActionInfo applicationInfo;
    /// // get applicationInfo from notification or query
    /// // ...
    /// teamService.rejectJoinApplication(
    ///     applicationInfo,
    ///     "postscript",
    ///     []() {
    ///         // reject join application success
    ///     },
    ///     [](V2NIMError error) {
    ///         // reject join application failed, handle error
    ///     });
    /// @endcode
    virtual void rejectJoinApplication(V2NIMTeamJoinActionInfo applicationInfo,
        nstd::string postscript,
        V2NIMSuccessCallback<void> success,
        V2NIMFailureCallback failure) = 0;

    /// @brief 设置成员角色
    /// @param teamId 群组 id
    /// @param teamType 群组类型
    /// @param memberAccountId 成员 id
    /// @param memberRole 设置新的角色类型
    /// @param success 成功回调
    /// @param failure 失败回调
    /// @return void
    /// @par 示例代码
    /// @code
    /// nstd::vector<nstd::string> memberAccountIds;
    /// memberAccountIds.push_back("account1");
    /// teamService.updateTeamMemberRole(
    ///     "teamId",
    ///     V2NIM_TEAM_TYPE_NORMAL,
    ///     memberAccountIds,
    ///     V2NIM_TEAM_MEMBER_ROLE_MANAGER,
    ///     []() {
    ///         // update team member role success
    ///     },
    ///     [](V2NIMError error) {
    ///         // update team member role failed, handle error
    ///     });
    /// @endcode
    virtual void updateTeamMemberRole(nstd::string teamId,
        V2NIMTeamType teamType,
        nstd::vector<nstd::string> memberAccountId,
        V2NIMTeamMemberRole memberRole,
        V2NIMSuccessCallback<void> success,
        V2NIMFailureCallback failure) = 0;

    /// @brief 移交群主
    /// @param teamId 群组 id
    /// @param teamType 群组类型
    /// @param accountId 新群主 id
    /// @param leave 是否同时退出群组
    /// @param success 成功回调
    /// @param failure 失败回调
    /// @return void
    /// @par 示例代码
    /// @code
    /// teamService.transferTeamOwner(
    ///     "teamId",
    ///     V2NIM_TEAM_TYPE_NORMAL,
    ///     "accountId",
    ///     false,
    ///     []() {
    ///         // transfer team owner success
    ///     },
    ///     [](V2NIMError error) {
    ///         // transfer team owner failed, handle error
    ///     });
    /// @endcode
    virtual void transferTeamOwner(nstd::string teamId,
        V2NIMTeamType teamType,
        nstd::string accountId,
        bool leave,
        V2NIMSuccessCallback<void> success,
        V2NIMFailureCallback failure) = 0;

    /// @brief 修改自己的群成员信息
    /// @param teamId 群组 id
    /// @param teamType 群组类型
    /// @param memberInfoParams 修改群成员信息参数
    /// @param success 成功回调
    /// @param failure 失败回调
    /// @return void
    /// @par 示例代码
    /// @code
    /// V2NIMUpdateSelfMemberInfoParams memberInfoParams;
    /// memberInfoParams.teamNick = "new nick";
    /// teamService.updateSelfTeamMemberInfo(
    ///     "teamId",
    ///     V2NIM_TEAM_TYPE_NORMAL,
    ///     memberInfoParams,
    ///     []() {
    ///         // update self team member info success
    ///     },
    ///     [](V2NIMError error) {
    ///         // update self team member info failed, handle error
    ///     });
    /// @endcode
    virtual void updateSelfTeamMemberInfo(nstd::string teamId,
        V2NIMTeamType teamType,
        V2NIMUpdateSelfMemberInfoParams memberInfoParams,
        V2NIMSuccessCallback<void> success,
        V2NIMFailureCallback failure) = 0;

    /// @brief 修改群成员昵称
    /// @param teamId 群组 id
    /// @param teamType 群组类型
    /// @param accountId 群成员 id
    /// @param nick 群成员昵称
    /// @param success 成功回调
    /// @param failure 失败回调
    /// @return void
    /// @par 示例代码
    /// @code
    /// teamService.updateTeamMemberNick(
    ///     "teamId",
    ///     V2NIM_TEAM_TYPE_NORMAL,
    ///     "accountId",
    ///     "new nick",
    ///     []() {
    ///         // update team member nick success
    ///     },
    ///     [](V2NIMError error) {
    ///         // update team member nick failed, handle error
    ///     });
    /// @endcode
    virtual void updateTeamMemberNick(nstd::string teamId,
        V2NIMTeamType teamType,
        nstd::string accountId,
        nstd::string teamNick,
        V2NIMSuccessCallback<void> success,
        V2NIMFailureCallback failure) = 0;

    /// @brief 设置群组禁言模式
    /// @param teamId 群组 id
    /// @param teamType 群组类型
    /// @param chatBannedMode 群组禁言模式
    /// @param success 成功回调
    /// @param failure 失败回调
    /// @return void
    /// @par 示例代码
    /// @code
    /// teamService.setTeamChatBannedMode(
    ///     "teamId",
    ///     V2NIM_TEAM_TYPE_NORMAL,
    ///     V2NIM_TEAM_CHAT_BANNED_MODE_BANNED_NORMAL,
    ///     []() {
    ///         // set team chat banned mode success
    ///     },
    ///     [](V2NIMError error) {
    ///         // set team chat banned mode failed, handle error
    ///     });
    /// @endcode
    virtual void setTeamChatBannedMode(nstd::string teamId,
        V2NIMTeamType teamType,
        V2NIMTeamChatBannedMode chatBannedMode,
        V2NIMSuccessCallback<void> success,
        V2NIMFailureCallback failure) = 0;

    /// @brief 设置群组成员聊天禁言状态
    /// @param teamId 群组 id
    /// @param teamType 群组类型
    /// @param accountId 群成员 id
    /// @param chatBanned 是否禁言
    /// @param success 成功回调
    /// @param failure 失败回调
    /// @return void
    /// @par 示例代码
    /// @code
    /// teamService.setTeamMemberChatBannedStatus(
    ///     "teamId",
    ///     V2NIM_TEAM_TYPE_NORMAL,
    ///     "accountId",
    ///     true,
    ///     []() {
    ///         // set team member chat banned status success
    ///     },
    ///     [](V2NIMError error) {
    ///         // set team member chat banned status failed, handle error
    ///     });
    /// @endcode
    virtual void setTeamMemberChatBannedStatus(nstd::string teamId,
        V2NIMTeamType teamType,
        nstd::string accountId,
        bool chatBanned,
        V2NIMSuccessCallback<void> success,
        V2NIMFailureCallback failure) = 0;

    /// @brief 获取当前已经加入的群组列表
    /// @param teamType 群组类型
    /// @param success 成功回调
    /// @param failure 失败回调
    /// @return void
    /// @par 示例代码
    /// @code
    /// nstd::vector<V2NIMTeamType> teamTypes;
    /// teamTypes.push_back(V2NIM_TEAM_TYPE_NORMAL);
    /// teamService.getJoinedTeamList(
    ///     teamTypes,
    ///     [](nstd::vector<V2NIMTeam> teamList) {
    ///         // get joined team list success
    ///     },
    ///     [](V2NIMError error) {
    ///         // get joined team list failed, handle error
    ///     });
    /// @endcode
    virtual void getJoinedTeamList(nstd::vector<V2NIMTeamType> teamTypes,
        V2NIMSuccessCallback<nstd::vector<V2NIMTeam>> success,
        V2NIMFailureCallback failure) = 0;

    /// @brief 获取当前已经加入的群组数量
    /// @param teamTypes 群组类型列表, 为空表示查询所有群类型
    /// @param success 成功回调
    /// @param failure 失败回调
    /// @return void
    /// @par 示例代码
    /// @code
    /// nstd::vector<V2NIMTeamType> teamTypes;
    /// teamTypes.push_back(V2NIM_TEAM_TYPE_NORMAL);
    /// auto count = teamService.getJoinedTeamCount(teamTypes);
    /// @endcode
    virtual uint32_t getJoinedTeamCount(nstd::vector<V2NIMTeamType> teamTypes) = 0;

    /// @brief 获取群组成员列表
    /// @param teamId 群组 id
    /// @param teamType 群组类型
    /// @param queryOption 群组成员查询选项
    /// @param success 成功回调
    /// @param failure 失败回调
    /// @return void
    /// @par 示例代码
    /// @code
    /// V2NIMTeamMemberQueryOption queryOption;
    /// queryOption.nextToken = ""; // first page
    /// queryOption.limit = 10;
    /// queryOption.direction = V2NIM_QUERY_DIRECTION_DESC;
    /// teamService.getTeamMemberList(
    ///     "teamId",
    ///     V2NIM_TEAM_TYPE_NORMAL,
    ///     queryOption,
    ///     [](V2NIMTeamMemberListResult result) {
    ///         // get team members success
    ///     },
    ///     [](V2NIMError error) {
    ///         // get team members failed, handle error
    ///     });
    /// @endcode
    virtual void getTeamMemberList(nstd::string teamId,
        V2NIMTeamType teamType,
        V2NIMTeamMemberQueryOption queryOption,
        V2NIMSuccessCallback<V2NIMTeamMemberListResult> success,
        V2NIMFailureCallback failure) = 0;

    /// @brief 根据账号 ID 列表获取群组成员列表
    /// @param teamId 群组 id
    /// @param teamType 群组类型
    /// @param accountIds 账号 ID 列表
    /// @param success 成功回调
    /// @param failure 失败回调
    /// @return void
    /// @par 示例代码
    /// @code
    /// nstd::vector<nstd::string> accountIds;
    /// accountIds.push_back("account1");
    /// accountIds.push_back("account2");
    /// teamService.getTeamMemberListByIds(
    ///     "teamId",
    ///     V2NIM_TEAM_TYPE_NORMAL,
    ///     accountIds,
    ///     [](nstd::vector<V2NIMTeamMember> memberList) {
    ///         // get team members by account ids success
    ///     },
    ///     [](V2NIMError error) {
    ///         // get team members by account ids failed, handle error
    ///     });
    /// @endcode
    virtual void getTeamMemberListByIds(nstd::string teamId,
        V2NIMTeamType teamType,
        nstd::vector<nstd::string> accountIds,
        V2NIMSuccessCallback<nstd::vector<V2NIMTeamMember>> success,
        V2NIMFailureCallback failure) = 0;

    /// @brief 根据账号 ID 列表获取群组成员邀请人
    /// @param teamId 群组 id
    /// @param teamType 群组类型
    /// @param accountIds 账号 ID 列表
    /// @param success 成功回调
    /// @param failure 失败回调
    /// @return void
    /// @par 示例代码
    /// @code
    /// nstd::vector<nstd::string> accountIds;
    /// accountIds.push_back("account1");
    /// accountIds.push_back("account2");
    /// teamService.getTeamMemberInvitor(
    ///     "teamId",
    ///     V2NIM_TEAM_TYPE_NORMAL,
    ///     accountIds,
    ///     [](nstd::map<nstd::string, nstd::string> invitors) {
    ///         // get team member invitor success
    ///     },
    ///     [](V2NIMError error) {
    ///         // get team member invitor failed, handle error
    ///     });
    /// @endcode
    virtual void getTeamMemberInvitor(nstd::string teamId,
        V2NIMTeamType teamType,
        nstd::vector<nstd::string> accountIds,
        V2NIMSuccessCallback<nstd::map<nstd::string, nstd::string>> success,
        V2NIMFailureCallback failure) = 0;

    /// @brief 获取群加入相关信息
    /// @param option 查询参数
    /// @param success 成功回调
    /// @param failure 失败回调
    /// @return void
    /// @par 示例代码
    /// @code
    /// V2NIMTeamJoinActionInfoQueryOption option;
    /// option.offset = 0;
    /// option.limit = 10;
    /// teamService.getTeamJoinActionInfoList(
    ///     option,
    ///     [](V2NIMTeamJoinActionInfoResult result) {
    ///         // get team join action info list success
    ///     },
    ///     [](V2NIMError error) {
    ///         // get team join action info list failed, handle error
    ///     });
    /// @endcode
    virtual void getTeamJoinActionInfoList(V2NIMTeamJoinActionInfoQueryOption option,
        V2NIMSuccessCallback<V2NIMTeamJoinActionInfoResult> success,
        V2NIMFailureCallback failure) = 0;

    /// @brief 根据关键字搜索群组，混合搜索高级群和超大群，使用 LIKE 方式匹配，只搜索群名称
    /// @param keyword 关键字
    /// @param success 成功回调
    /// @param failure 失败回调
    /// @return void
    /// @par 示例代码
    /// @code
    /// teamService.searchTeamByKeyword(
    ///     "keyword",
    ///     [](nstd::vector<V2NIMTeam> teamList) {
    ///         // search team by keyword success
    ///     },
    ///     [](V2NIMError error) {
    ///         // search team by keyword failed, handle error
    ///     });
    /// @endcode
    virtual void searchTeamByKeyword(nstd::string keyword, V2NIMSuccessCallback<nstd::vector<V2NIMTeam>> success, V2NIMFailureCallback failure) = 0;

    /// @brief 根据关键字搜索群组成员
    /// @param option 搜索选项 {@link V2NIMTeamMemberSearchOption}
    /// @param success 成功回调
    /// @param failure 失败回调
    /// @return void
    /// @par 示例代码
    /// @code
    /// V2NIMTeamMemberSearchOption option;
    /// option.keyword = "keyword";
    /// option.teamType = V2NIM_TEAM_TYPE_NORMAL;
    /// option.pageToken = "";
    /// teamService.searchTeamMembers(
    ///     option,
    ///     [](nstd::vector<V2NIMTeamMember> teamMembers) {
    ///         // search team members success
    ///     },
    ///     [](V2NIMError error) {
    ///         // search team members failed, handle error
    ///     });
    /// @endcode
    virtual void searchTeamMembers(V2NIMTeamMemberSearchOption option,
        V2NIMSuccessCallback<V2NIMTeamMemberListResult> success,
        V2NIMFailureCallback failure) = 0;

    /// @brief 添加群组监听器
    /// @param listener 群组监听器
    /// @return void
    /// @par 示例代码
    /// @code
    /// V2NIMTeamListener listener;
    /// listener.onSyncStarted = []() {
    ///     // team sync started
    /// };
    /// listener.onSyncFinished = []() {
    ///     // team sync finished
    /// };
    /// listener.onSyncFailed = [](V2NIMError error) {
    ///     // team sync failed, handle error
    /// };
    /// listener.onTeamCreated = [](V2NIMTeam team) {
    ///     // team created
    /// };
    /// listener.onTeamDismissed = [](nstd::vector<V2NIMTeam> teams) {
    ///     // team dismissed
    /// };
    /// listener.onTeamJoined = [](V2NIMTeam team) {
    ///     // team joined
    /// };
    /// listener.onTeamLeft = [](V2NIMTeam team, bool isKicked) {
    ///     // team left
    /// };
    /// listener.onTeamInfoUpdated = [](V2NIMTeam team) {
    ///     // team info updated
    /// };
    /// listener.onTeamMemberJoined = [](nstd::vector<V2NIMTeamMember> teamMembers) {
    ///     // team member joined
    /// };
    /// listener.onTeamMemberKicked = [](nstd::string operateAccountId, nstd::vector<V2NIMTeamMember> teamMembers) {
    ///     // team member kicked
    /// };
    /// listener.onTeamMemberLeft = [](nstd::vector<V2NIMTeamMember> teamMembers) {
    ///     // team member left
    /// };
    /// listener.onTeamMemberInfoUpdated = [](nstd::vector<V2NIMTeamMember> teamMembers) {
    ///     // team member info updated
    /// };
    /// listener.onReceiveTeamJoinActionInfo = [](V2NIMTeamJoinActionInfo joinActionInfo) {
    ///     // receive team join action info
    /// };
    /// teamService.addTeamListener(listener);
    /// @endcode
    virtual void addTeamListener(V2NIMTeamListener listener) = 0;

    /// @brief 移除群组监听器
    /// @return void
    /// @par 示例代码
    /// @code
    /// V2NIMTeamListener listener;
    /// // ...
    /// teamService.addTeamListener(listener);
    /// // ...
    /// teamService.removeTeamListener(listener);
    /// @endcode
    virtual void removeTeamListener(V2NIMTeamListener listener) = 0;
};
}  // namespace v2
#endif
